#include "forgetpwdwindow.h"
#include "ui_forgetpwdwindow.h"
#include "publicstruct.h"

#include <QStyleOption>

ForgetPwdWindow::ForgetPwdWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ForgetPwdWindow)
{
    ui->setupUi(this);

    // 窗口样式
    setQssStyle(QString("../style/ForgetPwdWindow.qss"),this);

    // 无边框
    this->setWindowFlags(Qt::FramelessWindowHint);

    // 第一页,返回上一级按钮不可见
    ui->btn_pre->setVisible(false);

    this->setWindowTitle("找回密码");
}

ForgetPwdWindow::~ForgetPwdWindow()
{
    delete ui;
}

void ForgetPwdWindow::Show()
{
    ui->stackedWidget->setCurrentWidget(ui->page);
    ui->btn_pre->setVisible(false);
    this->show();
}

void ForgetPwdWindow::paintEvent(QPaintEvent *event)
{
    QStyleOption opt;
    opt.initFrom(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

void ForgetPwdWindow::on_btn_close_clicked()
{
    this->close();
}


void ForgetPwdWindow::on_btn_next_clicked()
{
    ui->stackedWidget->setCurrentWidget(ui->page_2);
    // 第二页,该按钮可见
    ui->btn_pre->setVisible(true);
}


void ForgetPwdWindow::on_btn_pre_clicked()
{
    ui->stackedWidget->setCurrentWidget(ui->page);
    // 第一页,该按钮不可见
    ui->btn_pre->setVisible(false);
}

